package com.beyondsoft.provider;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

	private static String database_name = "books_database.db";
	private static int database_version = 1;
	public static String table = "books";

	public DatabaseHelper(Context context) {
		super(context, database_name, null, database_version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		String sql = "CREATE TABLE books(" + "id INTEGER PRIMARY KEY, "
				+ "name TEXT, " + "author TEXT);";
		db.execSQL(sql);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		String sql = "DROP TABLE IF EXISTS books ";
		db.execSQL(sql);
		onCreate(db);
		// db.execSQL("ARTER TABLE ......");
	}

}
